from camel.loaders import UnstructuredIO
uio = UnstructuredIO()



# #设置一个url示例
# example_url = ("https://www.cnblogs.com/")
# elements = uio.parse_file_or_url(example_url)
# print(("\n\n".join([str(el) for el in elements])))


# 设置示例脏文本
# example_dirty_text = ("\x93Some dirty text â€™ with extra spaces and – dashes.一些包含额外空格和破折号的脏文本â€™。")
# # 设置清理选项
# options = [
#     ('replace_unicode_quotes', {}),  # 替换Unicode引号
#     ('clean_dashes', {}),           # 清理破折号
#     ('clean_non_ascii_chars', {}),  # 清理非ASCII字符
#     ('clean_extra_whitespace', {}), # 清理多余空白
# ]
# cleaned_text = uio.clean_text_data(text=example_dirty_text,
#                                    clean_options=options)
# print(cleaned_text)
'''
replace_unicode_quotes: 将Unicode引号替换为标准引号

clean_dashes: 清理破折号，统一格式

clean_non_ascii_chars: 清理非ASCII字符

clean_extra_whitespace: 清理多余空白

clean_bullets: 清理项目符号

clean_ordered_bullets: 清理有序列表符号

clean_postfix: 清理后缀

clean_prefix: 清理前缀

clean_trailing_punctuation: 清理尾部标点

group_broken_paragraphs: 合并断开的段落

remove_punctuation: 移除标点符号

bytes_string_to_string: 将字节字符串转换为普通字符串

translate_text: 翻译文本
'''

# 设置示例文本用于提取
example_email_text = "你可以通过192.168.10.3联2024-09-01T09:00:00+0191399com2:00系19139928238@163.com我，在2024-10-19T14:30:00+08:00"
extracted_text = uio.extract_data_from_text(text=example_email_text,extract_type="extract_email_address")
print(extracted_text)

